package com.xueyi.system.packingManage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xueyi.common.core.constant.basic.SqlConstants;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.system.packingManage.domain.po.PackingManagePo;
import com.xueyi.system.packingManage.domain.query.PackingManageQuery;
import com.xueyi.system.packingManage.domain.dto.PackingManageDto;
import com.xueyi.system.packingManage.mapper.PackingManageMapper;
import com.xueyi.system.packingManage.service.IPackingManageService;
import com.xueyi.system.packingManage.manager.IPackingManageManager;
import com.xueyi.common.web.entity.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 包装管理管理 服务层处理
 *
 * @author yanhe
 */
@Service
public class PackingManageServiceImpl extends BaseServiceImpl<PackingManageQuery, PackingManageDto, IPackingManageManager> implements IPackingManageService {


    @Autowired
    private PackingManageMapper packingManageMapper;

    /**
     * 查询包装管理对象列表 | 数据权限 | 附加数据
     *
     * @param packingManage 包装管理对象
     * @return 包装管理对象集合
     */
    @Override
    //@DataScope(userAlias = "createBy", mapperScope = {"PackingManageMapper"})
    public List<PackingManageDto> selectListScope(PackingManageQuery packingManage) {
        return baseManager.selectListExtra(packingManage);
    }

    @Override
    public PackingManagePo getPackingManageInfo(Long batchId) {
        QueryWrapper<PackingManagePo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("batch_id",batchId);
        queryWrapper.last(SqlConstants.LIMIT_ONE);
        PackingManagePo packingManagePo = packingManageMapper.selectOne(queryWrapper);
        return packingManagePo;
    }
}
